<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/views/include/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="/views/include/nocachehead.jsp"%>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/validator/discoveryForm.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/attraction.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
<script type="text/javascript" src="http://j.maxmind.com/app/geoip.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/map.js"></script>
<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js" type="text/javascript"></script>
</head>

<body>
	<%@ include file="/views/include/statusbar.jsp"%>
	<br>
	<br>
	<br>


	<c:out value="${requestScope.errMsg}" escapeXml="false" />
	
	<form id="discoveryForm" action="${pageContext.request.contextPath}/attraction/discovery.html" method="post">
		<p>
			<label>地点名称：</label>
			<input id="name" name="name" onBlur="checkAttractionExist(this.value);" />
			<label id="nameExist" for="name" class="error" style="display:none;">已经存在该名字景点，请另外选择名称</label>
		</p> 
		<p>
			<label>景点分类：</label>
			<select name="category">
				<option value="ATTRACTION">景点</option>
				<option value="OTHER">其他</option>
			</select>
		</p>
		<p>
			<label>地点：</label>
			<select id="country" name="country" onchange="getProvinces('','')">
				<option value="">请选择</option>
			</select>
			<select id="province" name="province" onchange="getCities('')">
				<option value="">请选择</option>
			</select>
			<select id="city" name="city">
				<option value="">请选择</option>
			</select>
		</p>
		<p>
			<label> 具体地址：</label>
			<input type="text" name="detailAddress" id="detailAddress" value="" size="30"/>
		</p>
		<div id="searchMsg"></div>
		<div>
			<label>地图位置：</label>
			<span>在地图中找不到?</span>
			<input type="text" id="suggest" />
			<button id="serchLocation">搜搜看</button>
			<div id="mapContainer" style="height: 400px; width: 700px;"></div>
			<input id="latitude" name="latitude" type="hidden" />
			<input id="longitude" name="longitude" type="hidden" />
		</div>
		<p style="width:200px">
			<label>景点简介：</label>
			<textarea rows="5" cols="30" id="introduction" name="introduction"></textarea>
		</p>
		<p>
			<input type="hidden" name="submitToken"	value='<skyline:sessionAttribute key="SESSION_SUBMIT_TOKEN"/>' />
			<input type="submit" name="submit" value="提交" /> 
			<!-- <input type="reset" id="reset" value="取消" /> -->
		</p>
	</form>
	
	<script type="text/javascript">
	$(document).ready(function(){
		if(remote_ip_info) {
			try {
				getCountries(remote_ip_info.country, remote_ip_info.province+"省", remote_ip_info.city+"市");	
			} catch(e) {
				getCountries('','','');
			}
		}
		recenterMap(remote_ip_info.city);
		$('#discoveryForm').submit(function() {
			if(!nameChecked) {
				checkAttractionExist($("#name").val());
			}
			if(nameExist) {
				$("#name").focus();
				return false;
			} else {
				return true;
			}
		});
	});
	</script>
</body>
</html>